import {createRouter, createWebHistory} from "vue-router";
export const Layout = () => import("@/layout/index.vue");

// createApp方法，用于创建路由器实例，可以管理多个路由
export default createRouter({
    // 路由模式的设置
    history: createWebHistory(),
    // 管理路由
    routes: [
        {
            path: "/login",
            component: () => import("@/views/login/index.vue")
        },

        {
            path: "/",
            component: Layout,
            redirect: "/dash",
            children: [
                {
                    path: "/dash",
                    component: () => import("@/views/Dashboard/index.vue")
                },
                {
                    path: "/app",
                    component: () => import("@/views/platform/App/index.vue")
                },
                {
                    path: "/org",
                    component: () => import("@/views/platform/Org/index.vue")
                },
                {
                    path: "/dept",
                    component: () => import("@/views/platform/Dept/index.vue")
                },
                {
                    path: "/user",
                    component: () => import("@/views/platform/User/index.vue")
                },
            ],
        },
    ],
    // 滚动行为：控制滚动条的位置
    scrollBehavior() {
        return {
            left: 0,
            top: 0,
        };
    },
});
